Skip to main content

Getting Started

Welcome to Corva’s Dev Center! In this tutorial, we will show you how to get started building a Dev Center Back End app. If you would like to learn more about the different types of Back End apps that you can build, you can check out the Back End app documentation for a Stream App, Scheduled App or Task App. Before we dive into the code, here are a couple things you need to take care of…

1. Prerequisites

General Preparations

You’ll want to have completed the following steps before we move on:

  1. Get access to the Corva Dev Center GitHub repository. Here you’ll find sample code and Sample Apps to help you get started.

  2. Optional: Create your own personal project repository using your preferred platform e.g. GitHub, Bitbucket, etc. This will help you keep track of what you’re building and manage changes to your apps.

  3. Understand Tech stack Node.js, Python and Javascript You need to have at least some background using Python or Node.js before you start. If you’ve never programmed before, we suggest you try a Python or Node.js tutorial before you jump in to Dev Center.

  4. Understand basic Command Line Interface (CLI) commands for Linux or Windows. This is how you’ll configure the SDK and get app templates built out.

  5. Install your preferred Integrated Development Environment (IDE): e.g. Visual Studio Code, PyCharm, etc. This is where you’re going to be doing all the magic, so please make sure you’re comfortable with its features and usage.

  6. Download Git to run commands to push/pull code to your IDE and manage branching.

  7. Install Node.js Node v18.20.3 to help manage packages and dependencies.

  8. Review Corva’s Python SDK documentation (short version) to familiarize yourself with features and capabilities of the Dev Center Platform that are accessible in Python.

  9. Optional: To test Python backend applications locally, you will need to install Redis. You can easily set up Redis by using Docker to pull and run the Redis image.

  10. Review Corva’s Node.js SDK documentation (short version) to familiarize yourself with features and capabilities of the Dev Center Platform that are accessible in Node.js.

  11. Make sure your Dev Center Python SDK is up to date: in the command line run pip install -U corva-sdk (or within requirements.txt file e.g. set corva-sdk==1.3.0 , then run pip install -r requirements.txt).

  12. To update to latest version of Node.js SDK: in the command line run npm i @corva/node-sdk (or with Yarn:yarn add @corva/node-sdk).

Once you’ve completed the prerequisites, you’re ready to start creating your app!

Optional: Create and Activate Virtual Environment

Here are some guidelines to set up your environment.

Requirement: Python 3.8 to 3.11

Steps:

  1. Open terminal inside root of application folder.
    python -m venv env
    source ./env/bin/activate
  2. Create a directory ./env/ with isolated Python environment inside. You will be able to install needed packages there.
  3. Activate the new environment.

NOTE: From now on you must always have activated virtual environment when working with the project.

Optional: Install Make Dependency

Here is a guideline to install make dependency.

  1. Install make
    make install
    make all

2. Creating an App

Now, we’ll show you how to create a new app using the Dev Center’s App Wizard. You can watch the video and follow the steps below:

NOTE: In order to view videos in high resolution, please click on the Settings icon, then select the highest resolution available.

  1. First, Log in to Corva using your username and password

  2. Click the icon for Dev Center in the top right part of your browser window

  3. Click Add New App. You’ll do this for both Front End and Back End apps

  4. Click on Back End to select a new Back End app and click Next

Now you will have to choose what kind of Back End app you want create. There are three types you can choose from in the Corva SDK - Streaming, Scheduled Task. For the purposes of this tutorial, we’re going to make a stream app.

  1. Click on Stream to select a new Stream app and click Next

  2. Give your app a Name. This is the name that will appear in the Dev Center Store and will be used in the app key to refer to your app

  3. Select the data that your app will follow from the dropdown menu. This is the data stream that generates the event that will be used to trigger your app’s execution. Choose enhanced WITS for the purposes of this tutorial.

  4. Select segment and category and click next Tagging your app as a drilling or completions app will help your end users find your app in the App Store more easily

If your app requires storing custom data, you can create a dataset now. For the purposes of this tutorial we will skip it

  1. Make no changes in Dataset Creation and click Next

3. Copying App to Terminal

If you’ve made it this far, you’re doing great! The next step is to copy the app template to your development environment. The Dev Center App Wizard makes this easy by generating the string you need. You can watch the video and follow along with detailed instructions below:

NOTE: In order to view videos in high resolution, please click on the Settings icon, then select the highest resolution available.

Here’s how to copy the app template to your terminal window:

  1. From the App Wizard, copy the string to install the Command Line Tool

  2. Go to the command line interface and paste it and press enter to install

  3. Select a programming language for your Back End; we support both Node.js and Python

  4. Copy the create-corva-app Command Line Interface instructions and paste it in your CLI. Press enter to build out the templates

  5. Finalize your app in the App Wizard by clicking Add New App

image|690x395

How to select your preferred back end language.

At this point, you have a backend app template on your local machine that will display hello world in your console logs. You can modify it to include your own custom logic or continue following the tutorial to upload and publish your app.

4. Upload and Publish

Here, we are going to publish your app live in the Dev Center to test it out. You can watch the instructions in the video and follow the steps below:

NOTE: In order to view videos in high resolution, please click on the Settings icon, then select the highest resolution available.

  1. Open finder in Mac or Explorer in Windows and navigate to the directory where you’re building your Back End Corva app - e.g. c:/drilling_app/

  2. For a Python App select and zip up the following files:

    1. lambda_function

    2. manifest.json

    3. requirements.txt

    4. src (if applicable)

image|481x292

Required files for a Python app

  1. For a Node.js App select and zip the following files:

    1. src

    2. manifest.json

    3. test

    4. index.js

    5. package.json

    6. package-lock.json

    7. yarn.lock

image|298x342

Required files for a Node.js.App

  1. Using your browser, navigate to your app in Dev Center / Apps / New_App_Name / Versions
  2. Drag and drop the newly zipped file into the browser window, or click the upload button to upload via file explorer. You can optionally add version notes to document any changes that were made to your app.
  3. Click Upload to initiate the file upload to the Dev Center. Allow time for the app to be queued, processed, build and deploy. This process will depend on the size of your app and can take anywhere from seconds to a few minutes. It is highly sensitive to the sizes of the included libraries and packages your app uses.
  4. When the upload has successfully completed, the app should be in Draft status. Click Publish to make your app available to be visible in the app store.
  5. Click Label and choose either Stable Release or Beta.
  6. Select app visibility from dropdown. You can select Private (not visible in the store), Developer (visible only to developers in your company), or Company (visible to all users in your company)

image|690x147

App visibility feature options

5. Add App to an Asset

Now that the app is published in the store, it is available to be used on a company asset. Back End apps need to be added to the asset app stream to be invoked when new data is received. Watch the video and follow the detailed steps below:

NOTE: In order to view videos in high resolution, please click on the Settings icon, then select the highest resolution available.

NOTE: Back End apps can only be added to a single asset at a time.

1.In your browser, navigate to the Corva main page via top left Corva icon in navbar

image|690x76

Corva main page

  1. Click on Assets link in navbar

  2. Select and click on the asset name or search for the desired asset

Picture 6 |605x500

How to search for an asset

  1. Within the asset wellhub page mouse over to far right and click on the Data Stream dropdown arrow

  2. In the dropdown, click on the desired App Stream Name. This is where you can select which app stream you want your app to run in. This is the stream that will trigger your app to execute.

image|690x337

Select app stream name

  1. Click on the + button next to installed apps

image|690x331

Where to find the + button

  1. Within app store, search or filter to locate the newly created backend app

image|690x201

How to search for your new Back End app

  1. Click the + ADD button on the newly created app card

image|310x106

Add app to the app stream

  1. Your newly created app should now appear in the data stream app workflow page. This means that your stream app will be invoked every time a new data event is received from the enhanced WITS collection.

If everything went well, at this stage your app is up and running! Now, we’ll show you how to check your app’s log files to check for errors or other messages from your app.

6. View the App Log Files

Here’s how to access your app’s log files:

NOTE: In order to view videos in high resolution, please click on the Settings icon, then select the highest resolution available.

  1. In your browser, click on the Dev Center icon in top right hand corner

  2. Search for the desired backend app and select it from the app store

  3. In the left hand navigation bar, select the Log Files button to see recent messages from your app to the Console logs. You can use the built-in filters to search for specific messages, keywords, or assets, and sort by the time the message was received